package cn.stylefeng.guns.modular.gridsystem.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.gridsystem.service.BizGatewayConfigService;
import cn.stylefeng.guns.modular.gridsystem.model.param.BizGatewayConfigParam;

import javax.annotation.Resource;

/**
 * 网关配置表 控制器
 *
 * @author: ssy
 * @date: 2022/10/31 15:29
 */
@RestController
public class BizGatewayConfigController {

    @Resource
    private BizGatewayConfigService bizGatewayConfigService;

    /**
     * 分页查询网关配置表
     *
     * @author ssy
     * @date 2022/10/31 15:29
     */
    @GetMapping("/bizGatewayConfig/page")
    @BusinessLog(title = "网关配置表_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(BizGatewayConfigParam bizGatewayConfigParam) {
        return new SuccessResponseData(bizGatewayConfigService.page(bizGatewayConfigParam));
    }

    /**
     * 获取全部网关配置表
     *
     * @author ssy
     * @date 2022/10/31 15:29
     */
    @GetMapping("/bizGatewayConfig/list")
    @BusinessLog(title = "网关配置表_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list( ) {
        return new SuccessResponseData(bizGatewayConfigService.list());
    }

    /**
     * 查看详情网关配置表
     *
     * @author ssy
     * @date 2022/10/31 15:29
     */
    @GetMapping("/bizGatewayConfig/detail")
    @BusinessLog(title = "网关配置表_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(BizGatewayConfigParam.detail.class) BizGatewayConfigParam bizGatewayConfigParam) {
        return new SuccessResponseData(bizGatewayConfigService.detail(bizGatewayConfigParam));
    }

    /**
     * 添加网关配置表
     *
     * @author ssy
     * @date 2022/10/31 15:29
     */
    @PostMapping("/bizGatewayConfig/add")
    @BusinessLog(title = "网关配置表_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(BizGatewayConfigParam.add.class) BizGatewayConfigParam bizGatewayConfigParam) {
        bizGatewayConfigService.add(bizGatewayConfigParam);
        return new SuccessResponseData();
    }

    /**
     * 删除网关配置表
     *
     * @author ssy
     * @date 2022/10/31 15:29
     */
    @PostMapping("/bizGatewayConfig/delete")
    @BusinessLog(title = "网关配置表_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(BizGatewayConfigParam.delete.class) BizGatewayConfigParam bizGatewayConfigParam) {
        bizGatewayConfigService.delete(bizGatewayConfigParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑网关配置表
     *
     * @author ssy
     * @date 2022/10/31 15:29
     */
    @PostMapping("/bizGatewayConfig/edit")
    @BusinessLog(title = "网关配置表_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(BizGatewayConfigParam.edit.class) BizGatewayConfigParam bizGatewayConfigParam) {
        bizGatewayConfigService.edit(bizGatewayConfigParam);
        return new SuccessResponseData();
    }


}
